#!/bin/bash

source $DRAW_INI
source $DRAW_CFG

if [ -z $TARGET ];then
  LTAG=""
else
  LTAG="-L $TARGET"
fi

EVALNAME=$(basename $1)

java -Xmx4g -jar $GATK \
  -T VariantEval \
  -R $REF_FASTA \
  --dbsnp $SNPDB \
  $LTAG \
  -EV CountVariants \
  -o ${1}.eval \
  --eval:$EVALNAME ${1}.vcf \
  $2

EXITSTATUS=$?

if [ ! -s "${1}.eval" ];then echo "Missing ${1}.eval":exit 100;fi

exit $EXITSTATUS
